//
//  SDLevelDetailCell.m
//  Sudoku
//
//  Created by wxlan on 16/6/13.
//  Copyright © 2016年 wxlan. All rights reserved.
//

#import "SDLevelDetailCell.h"
@interface SDLevelDetailCell()
@property (weak, nonatomic) IBOutlet UIImageView *gameImage;
@property (weak, nonatomic) IBOutlet UIView *gameDescView;
@property (weak, nonatomic) IBOutlet UILabel *gameStateLabel;
@property (weak, nonatomic) IBOutlet UILabel *gameTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *lastTimeLabel;

@end

@implementation SDLevelDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.gameImage.backgroundColor = [UIColor redColor];
    UIColor *textColor = [UIColor grayColor];
    self.gameTimeLabel.textColor = textColor;
    self.gameStateLabel.textColor = textColor;
    self.lastTimeLabel.textColor = textColor;
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)levelDetailCellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"levelDetailCell";
    
    
    SDLevelDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"SDLevelDetailCell" owner:nil options:nil] lastObject];
    }
    return cell;

}

- (void)setLevelDetailModel:(SDLevelDetailModel *)levelDetailModel
{
    _levelDetailModel = levelDetailModel;
    self.gameDescView.hidden = NO;
    if (levelDetailModel.playState == LevelPlayStateNotStart) {
        self.gameDescView.hidden = YES;
        self.gameStateLabel.text = @"";
    }else if (levelDetailModel.playState == LevelPlayStatePlaying)
    {
        self.gameStateLabel.text = @"游戏中";
    }else
    {
        self.gameStateLabel.text = @"解决";
    }
    self.lastTimeLabel.text = levelDetailModel.lastTime;
    self.gameTimeLabel.text = levelDetailModel.playTime;
        
}

@end
